//
//  FindView.m
//  庐山通
//
//  Created by zcj on 15-10-25.
//  Copyright (c) 2015年 郑朝军. All rights reserved.
//

#import "FindView.h"
#import "UIImageView+WebCache.h"
#import "Grouble.h"
#import "FindModelFrame.h"
#import "FindModel.h"
#import "GoodsMainImageModel.h"
#import "GoodInforModel.h"

@interface FindView()
// 图片
@property (nonatomic,weak)UIImageView *topImg;
//  描述
@property (nonatomic,weak)UILabel *rettwen;
// 价格
@property (nonatomic,weak)UILabel *price;
// 城市
@property (nonatomic,weak)UILabel *city;

@end
@implementation FindView

- (id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self addView];
        // Initialization code
    }
    return self;
}
- (void)addView
{
    UIImageView * topImg = [[UIImageView alloc]init];
    [self addSubview:topImg];
    self.topImg = topImg;
    UILabel * retten = [[UILabel alloc]init];
    retten.numberOfLines = 0; // 换行
    [self addSubview:retten];
    self.rettwen = retten;
    
    UILabel * price = [[UILabel alloc]init];
    
    [self addSubview:price];
    self.price = price;
    
    UILabel * city = [[UILabel alloc]init];
    city.numberOfLines = 0;
    [self addSubview:city];
    self.city = city;
    
}

// 设置数据设置frame
- (void)setFindModelFrame:(FindModelFrame *)findModelFrame
{
    _findModelFrame  = findModelFrame;
    
    NSString * imgUrl = findModelFrame.findModel.main_image.image_original;
    
    [self.topImg setImageWithURL:[NSURL URLWithString:imgUrl] placeholderImage:[UIImage imageWithName:@"baoshi"]];
    
    self.topImg.frame = CGRectMake(0, 0, 100, 100);
    
    // 名称
    self.rettwen.text = findModelFrame.findModel.goods_name;
    
    self.rettwen.frame = findModelFrame.descF;
    
    
    // 价格
    self.price.text = findModelFrame.findModel.goods_display_final_price;
    self.price.frame = findModelFrame.priceF;
    // 城市
    
    self.city.text = findModelFrame.findModel.group_info.country;
    self.city.frame = findModelFrame.addressF;
    
    

}
@end
